package cn.tedu.tw.wyy.jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import static java.sql.DriverManager.getConnection;

public class AppJbdcInsert {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/test?useSSL=false";
        String username="root";
        String password="root";
        Connection connection= getConnection(url,username,password);
        Statement statement=connection.createStatement();
        String sql = "INSERT INTO `user` (`username`, `password`) VALUES ('Tom', MD5('123'))";
        int i = statement.executeUpdate(sql);
        if (i > 0) {
            System.out.println("插入成功！");
        }


    }
}
